﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Lir.Common;
using uming.Entity;
namespace uming.Data
{
    public class T_CommunicationsService : BaseDAL<T_Communications>
    {
        #region 对象实例及构造函数

        public static T_CommunicationsService Instance
        {
            get
            {
                return new T_CommunicationsService();
            }
        }
        public T_CommunicationsService()
            : base("T_Communications", "ID")
        {
        }

        #endregion
        /// <summary>
        /// 将DataReader的属性值转化为实体类的属性值，返回实体类
        /// </summary>
        /// <param name="dr">有效的DataReader对象</param>
        /// <returns>实体类对象</returns>
        protected override T_Communications DataReaderToEntity(IDataReader dataReader)
        {
            T_Communications info = new T_Communications();
            SmartDataReader reader = new SmartDataReader(dataReader);
            info.ID = reader.GetInt32("ID");
            info.C_Date = reader.GetDateTime("C_Date");
            info.Name = reader.GetString("Name");
            info.ProjectCode = reader.GetString("ProjectCode");
            info.Introduction = reader.GetString("Introduction");
            info.Attachment = reader.GetString("Attachment");

            return info;
        }

        /// <summary>
        /// 将实体对象的属性值转化为Hashtable对应的键值
        /// </summary>
        /// <param name="obj">有效的实体对象</param>
        /// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(T_Communications obj)
        {
            T_Communications info = obj as T_Communications;
            Hashtable hash = new Hashtable();
            hash.Add("C_Date", info.C_Date);
            hash.Add("Name", info.Name);
            hash.Add("ProjectCode", info.ProjectCode);
            hash.Add("Introduction", info.Introduction);
            hash.Add("Attachment", info.Attachment);
           

            return hash;
        }

    }
}
